package com.itheima.a01mycollection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class A03_CollectionDemo3 {
    public static void main(String[] args) {
        //1.创建集合并添加元素
        Collection<String> coll = new ArrayList<>();
        coll.add("aaa");
        coll.add("bbb");
        coll.add("ccc");

        //2，获取迭代器
        Iterator<String> it=coll.iterator();
        while(it.hasNext()){
            String str=it.next();
            System.out.println(str);
        }
    }
}

